package com.rupertjones.globalcron.server.dao;

import com.rupertjones.globalcron.common.domain.JobDescriptor;
import com.rupertjones.globalcron.common.domain.JobStore;

import java.util.Collection;

/**
 * <p>&copy Rupert Jones 2013</p>
 *
 * @author rup
 */
public class PersistenceJobStore implements JobStore {

    private JobDescriptorDAO jobDescriptorDAO;

    public PersistenceJobStore(JobDescriptorDAO jobDescriptorDAO) {
        this.jobDescriptorDAO = jobDescriptorDAO;
    }

    @Override
    public Collection<JobDescriptor> getAllJobs() {
        return jobDescriptorDAO.getAllJobs();
    }

    @Override
    public void upsert(JobDescriptor job) {
        jobDescriptorDAO.upsert(job);
    }

    @Override
    public JobDescriptor findById(int id) {
        return jobDescriptorDAO.findById(id);
    }
}
